home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1997 December / PC Pro December 1997 CD-Rom coverdisc.iso / symantec / dbAnywh / JAVA.BIN / CLASSES.ZIP / sun / applet / AppletViewerPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-12-14  |  1.8 KB  |  72 lines

  1. package sun.applet;
  2.  
  3. import java.applet.AppletContext;
  4. import java.awt.Component;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7. import java.util.Hashtable;
  8.  
  9. class AppletViewerPanel extends AppletPanel {
  10.    URL documentURL;
  11.    URL baseURL;
  12.    Hashtable atts;
  13.  
  14.    AppletViewerPanel(URL var1, Hashtable var2) {
  15.       this.documentURL = var1;
  16.       this.atts = var2;
  17.       String var3 = this.getParameter("zipbase");
  18.       if (var3 != null && !var3.endsWith("/")) {
  19.          try {
  20.             this.baseURL = new URL(var1, var3);
  21.          } catch (MalformedURLException var8) {
  22.          }
  23.       }
  24.  
  25.       if (this.baseURL == null) {
  26.          var3 = this.getParameter("codebase");
  27.          if (var3 != null) {
  28.             if (!var3.endsWith("/")) {
  29.                var3 = var3 + "/";
  30.             }
  31.  
  32.             try {
  33.                this.baseURL = new URL(var1, var3);
  34.             } catch (MalformedURLException var7) {
  35.             }
  36.          }
  37.       }
  38.  
  39.       if (this.baseURL == null) {
  40.          String var4 = var1.getFile();
  41.          int var5 = var4.lastIndexOf(47);
  42.          if (var5 > 0 && var5 < var4.length() - 1) {
  43.             try {
  44.                this.baseURL = new URL(var1, var4.substring(0, var5 + 1));
  45.             } catch (MalformedURLException var6) {
  46.             }
  47.          }
  48.       }
  49.  
  50.       if (this.baseURL == null) {
  51.          this.baseURL = var1;
  52.       }
  53.  
  54.    }
  55.  
  56.    public String getParameter(String var1) {
  57.       return (String)this.atts.get(var1.toLowerCase());
  58.    }
  59.  
  60.    public URL getDocumentBase() {
  61.       return this.documentURL;
  62.    }
  63.  
  64.    public URL getCodeBase() {
  65.       return this.baseURL;
  66.    }
  67.  
  68.    public AppletContext getAppletContext() {
  69.       return (AppletContext)((Component)this).getParent();
  70.    }
  71. }
  72.